#!/usr/bin/env python
# encoding: utf-8

"""
@author: Jython <ijython@qq.com>
@license: Apache Licence 
@file: hdfs.py
@time: 2017/10/16 5:33
"""


import sys,re
"""
tt='2017-10-14T00:38:51+08:00	/lmsMessage/count?m=0.34534870104090887	200	0.034	0.034	UUID=0FC3AB0A0CFD0E58730B3C4002EF7815-	58.246.79.114	i.hfjy.com	httGET	"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36"	"http://i.hfjy.com/resource/index.html"	10.46.228.28:8001	30'
print tt.split('\t')
"""
uuser={}
users=open('user.txt')
uu=users.readlines()
for u in uu:
	temp_u=u.split(",")
	uuser[temp_u[0]]=temp_u
#print uu
user_re=re.compile('\?userId=(?P<userid>\d+)')
uuidd={}
for line in sys.stdin:
	line=line.strip()
	words =line.split()
	for word in words:
		print "%s\t%s" % (word,1)
	continue
	line_arr=line.split('\t')
	for tt in line_arr:
		tt.strip()
	url=line_arr[1]
	uuid=line_arr[5]
	if url.startswith('/lmsMessage') or (url.startswith('/resource/') and url.find('.html')==-1 and url.find('userId')==-1) or url.find('favicon.ico')>-1:
		continue
	userinfo=user_re.search(url)
	if userinfo:
		user_id=userinfo.groupdict()['userid']
		user_info=uuser[str(user_id)]
		uuidd[uuid]=user_id
		line_arr[2]='200'
		line_arr.insert(0,user_id)
		line_arr.insert(0,user_info[2].strip())
		#print '@'.join(line_arr).strip()
		#print "%s\t%s" % ('@'.join(line_arr).strip(), 1)
		print "%s\t%s" % (user_info[2].strip(), 1)
		#print url
		#print "%s\t%s" % (line, 1)
	else:
		user_id=uuidd.get(uuid)
		if user_id:
			user_info=uuser[str(user_id)]
			line_arr.insert(0,user_id)
			line_arr.insert(0,user_info[2].strip())
			#print '@'.join(line_arr).strip()
			#print line
			#print line
	#print "%s\t%s" % ('@'.join(line_arr), 1)
	#sprint "%s\t%s" % ('@'.join(line_arr), 1)
		#print line
		#print "%s\t%s" % (line, 1)
	#print line

		#print "%s|||%s" % (line, 1)
	#print '------------------'